import Vue from 'vue'
import VueRouter from 'vue-router'

import { noticeRoute } from '@/views/notice/router'

import Layout from '@/views/layout/index.vue'

Vue.use(VueRouter)

let routes = [
  {
    path: '/',
    redirect: '/home/index',
    hide: true
  },
  {
    path: '/home',
    name: 'Home',
    // full控制2级是否显示
    // hide控制一级是否隐藏
    // hide:true, 不写默认为false
    meta: { title: '首页', full: true, icon: 'user' },
    component: Layout,
    children: [{
      path: 'index',
      name: 'index1',
      meta: { title: '首页' },
      component: () => import('@/views/home/index.vue')
    }]
  }
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

routes = routes.concat(noticeRoute)

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
